
// 爬任务
import { BuildTask } from '../creep/creepTasks/buildTask';
import { CarryTask } from '../creep/creepTasks/carryTask';
import { HarvestSourcTask } from '../creep/creepTasks/harvestSourcTask';
import { UpgradeTask } from '../creep/creepTasks/upgradeTask';
import { HatcherTask } from '../creep/creepTasks/hatcherTask';
import { UpgradeCarryTask } from '../creep/creepTasks/upgradeCarryTask';
import { PathfinderTask } from '../creep/creepTasks/pathfinderTask';

// 旗子命令任务
import { ClaimerFlagTask } from '../flag/flagTasks/claimerFlagTask';
import { OuterOreFlagTask } from '../flag/flagTasks/outerOreFlagTask';
import { OuterOreManagerFlagTask } from '../flag/flagTasks/outerOreManagerFlag';

// 房间任务
import { SpawnQueueTask } from '../room/spawnQueueTask';

// 外矿任务
import { SourceTask } from '../flag/outerOreTasks/sourceTask';
import { outerOreCarryTask } from '../flag/outerOreTasks/outerOreCarryTask';
import { OuterOreCarryTask } from '../creep/creepTasks/outerOreCarryTask';
import { ReserveControllerTask } from '../flag/outerOreTasks/reserveControllerTask';
import { OuterOreReserveTask } from '../creep/creepTasks/outerOreReserveTask';
import { EventLogRoomTask } from '../room/eventLogRoomTask';
import { AttacEventTask } from '../event/attacEventTask';
import { DefenseRoomTask } from '../room/defenseRoomTask';
import { DefenderTask } from '../creep/creepTasks/defenderTask';
import { RoadTask } from '../flag/flagTasks/roadPlanningTask';
import { RemoveAllConstructionSite } from '../flag/flagTasks/removeAllConstructionSite';
import { outerOreBuildTask } from '../flag/outerOreTasks/outerOreBuildTask';
import { BuildCheckTask } from '../room/buildCheckTask';
import { TowerTask } from '../room/towerTask';
import { OuterOreCarryRelayTask } from '../creep/creepTasks/outerOreCarryRelayTask';
import { OuterOreProtectTask } from '../flag/outerOreTasks/outerOreProtectTask';
import { AttackFlagTask } from '../flag/flagTasks/attackFlagTask';
import { AttackCreepFlagTask } from '../creep/creepTasks/attackCreepFlagTask';
import { HealFlagTask } from '../flag/flagTasks/healFlagTask';
import { HealCreepFlagTask } from '../creep/creepTasks/healCreepFlagTask';


const CreepsConfig:Array<{ controllerLevel:number,creeps:Array<{role:string,count:number,body:BodyPartConstant[],bodyWeight:{ [part: string]: number },bodyEnergy?:number,taskLogic:ICreepTask }> }>  = [
  {
    controllerLevel:1,
    creeps:[
      {
        role:"hatcher",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.4,
          [MOVE]: 0.3,
          [CARRY]: 0.3,
        },
        taskLogic: new HatcherTask 
      },
      {
        role:"harvesterSourc",
        count:4,
        body:[],
        bodyWeight:{
          [WORK]: 0.8,
          [MOVE]: 0.1,
          [CARRY]: 0.1,
        },
        taskLogic: new HarvestSourcTask 
      },
      {
        role:"upgrade",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.5,
          [CARRY]:0.25,
          [MOVE]: 0.25,
        },
        taskLogic: new UpgradeTask 
      }
    ]
  },
  {
    controllerLevel:2,
    creeps:[
      {
        role:"hatcher",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.4,
          [MOVE]: 0.3,
          [CARRY]: 0.3,
        },
        taskLogic: new HatcherTask 
      },
      {
        role:"harvesterSourc",
        count:4,
        body:[],
        bodyWeight:{
          [WORK]: 0.8,
          [MOVE]: 0.1,
          [CARRY]: 0.1,
        },
        taskLogic: new HarvestSourcTask 
      },
      {
        role:"upgrade",
        count:4,
        body:[],
        bodyWeight:{
          [WORK]:0.5,
          [CARRY]: 0.25,
          [MOVE]: 0.25,
        },
        taskLogic: new UpgradeTask 
      },
      {
        role:"upgrade_carry",
        count:2,
        body:[],
        bodyWeight:{
          [CARRY]: 0.5,
          [MOVE]: 0.5,
        },
        taskLogic: new UpgradeCarryTask 
      }
    ]
  },
  {
    controllerLevel:3,
    creeps:[
      {
        role:"hatcher_super",
        count:1,
        body:[],
        bodyWeight:{
          [WORK]: 0.3,
          [MOVE]: 0.35,
          [CARRY]: 0.35,
        },
        taskLogic: new HatcherTask 
      },
      {
        role:"harvesterSourc",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.8,
          [MOVE]: 0.1,
          [CARRY]: 0.1,
        },
        taskLogic: new HarvestSourcTask 
      },
      {
        role:"carry",
        count:2,
        body:[],
        bodyWeight:{          
          [MOVE]: 0.5,
          [CARRY]: 0.5,
        },
        taskLogic: new CarryTask 
      },
      {
        role:"upgrade",
        count:4,
        body:[],
        bodyWeight:{
          [WORK]: 0.7,
          [MOVE]: 0.2,
          [CARRY]: 0.1,
        },
        taskLogic: new UpgradeTask 
      },
      {
        role:"upgrade_carry",
        count:2,
        body:[],
        bodyWeight:{
          [MOVE]: 0.5,
          [CARRY]: 0.6,
        },
        taskLogic: new UpgradeCarryTask
      },
    ]
  },
  {
    controllerLevel:4,
    creeps:[
      {
        role:"hatcher",
        count:1,
        body:[WORK,MOVE,CARRY,CARRY,CARRY],
        bodyWeight:{},
        taskLogic: new HatcherTask 
      },
      {
        role:"hatcher_super",
        count:1,
        body:[],
        bodyWeight:{
          [WORK]: 0.3,
          [MOVE]: 0.35,
          [CARRY]: 0.35,
        },
        bodyEnergy: 1000,
        taskLogic: new HatcherTask 
      },
      {
        role:"harvesterSourc",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.8,
          [MOVE]: 0.1,
          [CARRY]: 0.1,
        },
        taskLogic: new HarvestSourcTask 
      },
      {
        role:"carry",
        count:1,
        body:[],
        bodyWeight:{
          [MOVE]: 0.5,
          [CARRY]: 0.5,
        },
        taskLogic: new CarryTask 
      },
      {
        role:"upgrade",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.7,
          [MOVE]: 0.2,
          [CARRY]: 0.1,
        },
        taskLogic: new UpgradeTask 
      },
      {
        role:"upgrade_carry",
        count:1,
        body:[],
        bodyWeight:{
          [MOVE]: 0.5,
          [CARRY]: 0.5,
        },
        taskLogic: new UpgradeCarryTask
      },
    ]
  },
  {
    controllerLevel:5,
    creeps:[
      {
        role:"hatcher",
        count:1,
        body:[WORK,MOVE,CARRY,CARRY,CARRY],
        bodyWeight:{},
        taskLogic: new HatcherTask 
      },
      {
        role:"hatcher_super",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.3,
          [MOVE]: 0.35,
          [CARRY]: 0.35,
        },
        bodyEnergy: 1300,
        taskLogic: new HatcherTask 
      },
      {
        role:"harvesterSourc",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.8,
          [MOVE]: 0.1,
          [CARRY]: 0.1,
        },
        bodyEnergy: 1300,
        taskLogic: new HarvestSourcTask 
      },
      {
        role:"carry",
        count:1,
        body:[],
        bodyWeight:{
          [MOVE]: 0.5,
          [CARRY]: 0.5,
        },
        bodyEnergy: 1300,
        taskLogic: new CarryTask 
      },
      {
        role:"upgrade",
        count:2,
        body:[],
        bodyWeight:{
          [WORK]: 0.7,
          [MOVE]: 0.15,
          [CARRY]: 0.15,
        },
        taskLogic: new UpgradeTask
      },
      // {
      //   role:"upgrade_carry",
      //   count:1,
      //   body:[],
      //   bodyWeight:{
      //     [MOVE]: 0.5,
      //     [CARRY]: 0.5,
      //   },
      //   taskLogic: new UpgradeCarryTask
      // },
    ]
  },
  {
    controllerLevel:6,
    creeps:[]//暂时为空
  },
  {
    controllerLevel:7,
    creeps:[]//暂时为空
  },
  {
    controllerLevel:8,
    creeps:[]//暂时为空
  }
]

// 旗帜命令配置
const FlagConfig:any[] = [
  {
    flagName:'占领',
    taskLogic:ClaimerFlagTask
  },
  {
    flagName:'外矿',
    taskLogic:OuterOreFlagTask
  },
  {
    flagName:'外矿房间管理',
    taskLogic:OuterOreManagerFlagTask
  },
  {
    flagName:'道路规划',
    taskLogic:RoadTask
  },
  {
    flagName:'工地清除',
    taskLogic:RemoveAllConstructionSite
  },
  {
    flagName:'攻击',
    taskLogic:AttackFlagTask
  },
  {
    flagName:'医疗',
    taskLogic:HealFlagTask
  }
]

/**
 * 特殊爬虫任务
 */
const SpecialCreeps = [
  {
    role:"pathfinder",
    taskLogic: PathfinderTask 
  },
  {
    role:"outerOreCarry",
    taskLogic:OuterOreCarryTask
  },
  {
    role:"outerOre_reserve",
    taskLogic:OuterOreReserveTask
  },
  {
    role:"defender",
    taskLogic:DefenderTask
  },
  {
    role:"build",
    taskLogic:BuildTask
  },
  {
    role:"outerOre_carry_relay",
    taskLogic:OuterOreCarryRelayTask
  },
  {
    role:"attack_flag",
    taskLogic:AttackCreepFlagTask
  },
  {
    role:"heal_flag",
    taskLogic:HealCreepFlagTask
  }
]

// 外矿任务
const OuterOreTask:Array<IOuterOreTask> = [
  new SourceTask,
  new outerOreCarryTask,
  new ReserveControllerTask,
  new outerOreBuildTask,
  new OuterOreProtectTask,
]


// 房间任务
const RoomTask:Array<IRoomTask> = [
  new EventLogRoomTask,
  new SpawnQueueTask,
  new DefenseRoomTask,
  new BuildCheckTask,
  new TowerTask,
]

// 事件任务
const EventTask:Array<{ event:number,task:IEventTask }> = [
  {
    event:EVENT_ATTACK,
    task:new AttacEventTask
  }
];

export { CreepsConfig,FlagConfig,RoomTask,SpecialCreeps,OuterOreTask,EventTask };